This notebook is for the acoustic analysis of the falling diphthongs in the standard Mandarin with the approach GAMMs.

#install.packages('rmarkdown')
# Importation des emballages 
#install.packages("itsadug")

library(ggplot2)
library(mgcv)
## Loading required package: nlme
## This is mgcv 1.8-33. For overview type 'help("mgcv-package")'.
library(itsadug)
## Loading required package: plotfunctions
## 
## Attaching package: 'plotfunctions'
## The following object is masked from 'package:ggplot2':
## 
##     alpha
## Loaded package itsadug 2.4 (see 'help("itsadug")' ).
source("gamm_hacks.r")
#install.packages("tidyverse")
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ tibble  3.1.0     ✓ dplyr   1.0.5
## ✓ tidyr   1.1.3     ✓ stringr 1.4.0
## ✓ readr   1.4.0     ✓ forcats 0.5.1
## ✓ purrr   0.3.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x plotfunctions::alpha() masks ggplot2::alpha()
## x dplyr::collapse()      masks nlme::collapse()
## x dplyr::filter()        masks stats::filter()
## x dplyr::lag()           masks stats::lag()

After the importation of the packages, let’s read the data.

# Importation des données 

au <- read.table(file="au0b.tsv",sep="\t", fileEncoding = 'UTF-16', header = TRUE)
ai <- read.table(file="ai0a.tsv",sep="\t", fileEncoding = 'UTF-16', header = TRUE)
ei <- read.table(file="ei0a.tsv",sep="\t", fileEncoding = 'UTF-16', header = TRUE)
ou <- read.table(file="ou0a.tsv",sep="\t", fileEncoding = 'UTF-16', header = TRUE)

Change of the nature of the variables in the dataset.

The criterion is that all the numerical variables are numerated and the string varibles are factored.

1 /ai/

Lets start from /ai/:

ai$sexe<-as.factor(ai$sexe)
ai$ton<-as.factor(ai$ton)
ai$pow<-as.factor(ai$pow)
ai$contexte.D<-as.factor(ai$contexte.D)
ai$contexte.G<-as.factor(ai$contexte.G)

ai$f1<-as.numeric(ai$f1)
## Warning: NAs introduced by coercion
ai$f2<-as.numeric(ai$f2)
## Warning: NAs introduced by coercion
ai$f3<-as.numeric(ai$f3)
## Warning: NAs introduced by coercion
ai$f0<-as.numeric(ai$f0)
## Warning: NAs introduced by coercion
head(ai)
##   numero sexe locuteur diphtongue ton pow contexte.G contexte.D duree.ms.
## 1      1    F     FS11         ai   4   f          h          0  102.6625
## 2      1    F     FS11         ai   4   f          h          0  102.6625
## 3      1    F     FS11         ai   4   f          h          0  102.6625
## 4      1    F     FS11         ai   4   f          h          0  102.6625
## 5      1    F     FS11         ai   4   f          h          0  102.6625
## 6      1    F     FS11         ai   4   f          h          0  102.6625
##   measurement.no       f1       f2       f3       f0
## 1              0 770.9403 1592.367 2791.365 242.7606
## 2              1 789.5770 1654.538 2661.433 232.8865
## 3              2 790.5264 1676.141 2643.341 228.2137
## 4              3 792.7979 1771.876 2587.896 224.4104
## 5              4 786.4961 1814.919 2436.698 219.7656
## 6              5 760.0966 1827.338 2542.548 214.1222

In the dataset we can see the number of the data numero, the gender sexe, the speaker locuteur, the tone ton, the position in the word pow, the context before and after this diphthong contexte.G / contexte.D, the duration of the diphthongs duree.ms. and f0, f1, f2, f3 trajectories, each of them represented by 11 measurements taken at equal intervals (at 0%, 10%, 20%, . . . , 100%).

# Regroupement par les facteurs
ai.mas <- droplevels(subset(ai,sexe=="M"))
ai.fem <- droplevels(subset(ai,sexe=="F"))

1.1 Masculin

1.1.1 F1

Then the trajectories of f1 in different tones with regard of the sexes and the durations.

ggplot(ai.mas, aes(x=measurement.no, y=f1, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 28 row(s) containing missing values (geom_path).

ggplot(ai.fem, aes(x=measurement.no, y=f1, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 25 row(s) containing missing values (geom_path).

Then the first model with a basic smooth of tone 1 and difference smooths.

ai.mas$ton.ord <- as.ordered(ai.mas$ton)
contrasts(ai.mas$ton.ord) <- "contr.treatment"
ai.mas.gam.diff <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                        s(measurement.no, by=ton.ord, bs="cr"),
                      data=ai.mas, method="ML")
summary.coefs(ai.mas.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   508.92      20.76  24.514  < 2e-16 ***
## ton.ord2      120.43      22.33   5.393 8.47e-08 ***
## ton.ord3      173.89      23.07   7.536 1.01e-13 ***
## ton.ord4      109.93      21.51   5.110 3.81e-07 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F  p-value    
## s(measurement.no)          4.434  5.392  5.263 5.67e-05 ***
## s(measurement.no):ton.ord2 1.017  1.032 10.413  0.00111 ** 
## s(measurement.no):ton.ord3 1.001  1.002  4.728  0.02980 *  
## s(measurement.no):ton.ord4 3.570  4.385  7.968 1.47e-06 ***

Then the plots of predictions and difference smooth.

plot_smooth(ai.mas.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(ai.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 7.575758
plot_diff(ai.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  2.323232 - 10.000000
plot_diff(ai.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 2.929293
##  6.969697 - 10.000000

The model that accounts for the influence of duree.ms. on the trajectories.

ai.mas.gam.dur <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(duree.ms., bs="cr") +
                              ti(measurement.no, duree.ms.) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ai.mas, method="ML")
summary.coefs(ai.mas.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   521.48      20.47  25.471  < 2e-16 ***
## ton.ord2       96.33      22.45   4.291 1.94e-05 ***
## ton.ord3      174.32      22.42   7.777 1.74e-14 ***
## ton.ord4       97.59      21.32   4.578 5.25e-06 ***
## 
## Approximate significance of smooth terms:
##                                edf Ref.df     F  p-value    
## s(measurement.no)            4.526  5.458 2.689   0.0153 *  
## s(duree.ms.)                 5.581  6.507 5.202 3.61e-05 ***
## ti(measurement.no,duree.ms.) 7.258  9.082 4.050 3.73e-05 ***
## s(measurement.no):ton.ord2   2.838  3.498 7.788 1.66e-05 ***
## s(measurement.no):ton.ord3   2.279  2.815 3.364   0.0173 *  
## s(measurement.no):ton.ord4   4.009  4.879 6.286 1.52e-05 ***

The plots with regard the durations.

plot_smooth(ai.mas.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.mas.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.mas.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(ai.mas$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 80.084553 to 197.994270. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

The model with regard of f0.

ai.mas.gam.f0 <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(f0, bs="cr") +
                              ti(measurement.no, f0) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ai.mas, method="ML")
summary.coefs(ai.mas.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   515.84      19.38  26.619  < 2e-16 ***
## ton.ord2       98.96      21.39   4.628 4.21e-06 ***
## ton.ord3      133.59      22.60   5.912 4.69e-09 ***
## ton.ord4       99.55      19.87   5.009 6.49e-07 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F  p-value    
## s(measurement.no)          5.043  6.028 3.347 0.002781 ** 
## s(f0)                      2.675  3.219 6.283 0.000272 ***
## ti(measurement.no,f0)      3.877  4.994 2.958 0.011798 *  
## s(measurement.no):ton.ord2 3.114  3.839 7.162 2.42e-05 ***
## s(measurement.no):ton.ord3 2.262  2.803 6.325 0.000460 ***
## s(measurement.no):ton.ord4 4.213  5.118 8.474  < 2e-16 ***

The plot of such model.

plot_smooth(ai.mas.gam.f0, view="measurement.no", cond=list(f0=100),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 100. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.mas.gam.f0, view="measurement.no", cond=list(f0=120),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 120. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.mas.gam.f0, view="measurement.no", cond=list(f0=140),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 140. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.mas.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.mas.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.mas.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(ai.mas$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 100.125696 to 212.400605. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

#ai.mas.gam.smooth <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
#                           s(f0, bs="cr") +
#                           ti(measurement.no, f0) +
#                           s(measurement.no, by=ton.ord, bs="cr") +
#                           s(measurement.no, numero, bs="fs", xt="cr", m=1, k=5),
#                         data=ai.mas, method="fREML")

We now focus on the central portion of the diphthongs, which means the portions without the inluence of the consonant contexts.

ai.central<-droplevels(subset(ai,measurement.no>=2))
ai.central<-droplevels(subset(ai.central,measurement.no<=8))

ai.central.mas <- droplevels(subset(ai.central,sexe=="M"))
ai.central.fem <- droplevels(subset(ai.central,sexe=="F"))
ai.central.mas$ton.ord <- as.ordered(ai.central.mas$ton)
contrasts(ai.central.mas$ton.ord) <- "contr.treatment"
ai.central.mas.gam.diff <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                        s(measurement.no, by=ton.ord, bs="cr",k=6),
                      data=ai.central.mas, method="ML")
summary.coefs(ai.central.mas.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   472.08      19.51  24.201  < 2e-16 ***
## ton.ord2      171.54      20.96   8.184 1.28e-15 ***
## ton.ord3      225.45      21.68  10.399  < 2e-16 ***
## ton.ord4      187.63      20.19   9.292  < 2e-16 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F  p-value    
## s(measurement.no)          2.404  2.924 9.433 1.01e-05 ***
## s(measurement.no):ton.ord2 1.002  1.004 0.147   0.7039    
## s(measurement.no):ton.ord3 1.002  1.005 1.309   0.2530    
## s(measurement.no):ton.ord4 2.529  3.067 2.551   0.0533 .
plot_smooth(ai.central.mas.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(ai.central.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  2.000000 - 8.000000
plot_diff(ai.central.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  2.848485 - 8.000000
plot_diff(ai.central.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  2.000000 - 3.030303
##  5.818182 - 8.000000
ai.central.mas.gam.dur <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(duree.ms., bs="cr",k=6) +
                              ti(measurement.no, duree.ms.,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=ai.central.mas, method="ML")
summary.coefs(ai.central.mas.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   483.05      19.43  24.864  < 2e-16 ***
## ton.ord2      153.92      21.26   7.239 1.19e-12 ***
## ton.ord3      225.56      21.26  10.609  < 2e-16 ***
## ton.ord4      175.66      20.20   8.697  < 2e-16 ***
## 
## Approximate significance of smooth terms:
##                                edf Ref.df      F  p-value    
## s(measurement.no)            2.393  2.910 10.314 3.87e-06 ***
## s(duree.ms.)                 4.484  4.852  4.597 0.000297 ***
## ti(measurement.no,duree.ms.) 1.236  1.431  5.669 0.006689 ** 
## s(measurement.no):ton.ord2   1.000  1.000  0.094 0.759550    
## s(measurement.no):ton.ord3   1.000  1.001  1.487 0.223105    
## s(measurement.no):ton.ord4   2.587  3.131  2.965 0.029587 *
plot_smooth(ai.central.mas.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.mas.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.central.mas.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(ai.central.mas$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 80.084553 to 197.994270. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

ai.central.mas.gam.f0 <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(f0, bs="cr",k=6) +
                              ti(measurement.no, f0,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=ai.central.mas, method="ML")
summary.coefs(ai.central.mas.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   480.55      18.43  26.068  < 2e-16 ***
## ton.ord2      159.40      20.21   7.886  1.3e-14 ***
## ton.ord3      182.35      21.24   8.583  < 2e-16 ***
## ton.ord4      178.19      18.85   9.455  < 2e-16 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F  p-value    
## s(measurement.no)          2.449  2.975 7.785  5.8e-05 ***
## s(f0)                      2.888  3.362 5.997 0.000297 ***
## ti(measurement.no,f0)      1.005  1.010 6.139 0.013357 *  
## s(measurement.no):ton.ord2 1.000  1.000 0.233 0.629530    
## s(measurement.no):ton.ord3 1.000  1.001 0.006 0.938828    
## s(measurement.no):ton.ord4 2.698  3.256 2.878 0.031657 *
plot_smooth(ai.central.mas.gam.f0, view="measurement.no", cond=list(f0=100),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 100. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.mas.gam.f0, view="measurement.no", cond=list(f0=120),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 120. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.mas.gam.f0, view="measurement.no", cond=list(f0=140),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 140. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.mas.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.mas.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.central.mas.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(ai.mas$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 100.125696 to 212.400605. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

1.1.2 F2

Now we look at the trajectories of f2 in different tones with regard of the sexes and the durations.

ggplot(ai.mas, aes(x=measurement.no, y=f2, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 28 row(s) containing missing values (geom_path).

ggplot(ai.fem, aes(x=measurement.no, y=f2, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 25 row(s) containing missing values (geom_path).

Then we fit the same model with a basic smooth of tone 1 and difference smooths.

ai.mas.f2.gam.diff <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr") +
                        s(measurement.no, by=ton.ord, bs="cr"),
                      data=ai.mas, method="ML")
summary.coefs(ai.mas.f2.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1808.78      25.76  70.213  < 2e-16 ***
## ton.ord2     -190.78      27.71  -6.885 9.73e-12 ***
## ton.ord3     -182.21      28.63  -6.364 2.89e-10 ***
## ton.ord4     -157.18      26.70  -5.887 5.22e-09 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F  p-value    
## s(measurement.no)          3.783  4.654 6.929 7.58e-06 ***
## s(measurement.no):ton.ord2 1.000  1.001 0.783    0.376    
## s(measurement.no):ton.ord3 1.001  1.001 0.225    0.635    
## s(measurement.no):ton.ord4 1.004  1.008 0.360    0.550

Now the plots of f2 with different tones.

plot_smooth(ai.mas.f2.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(ai.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 10.000000
plot_diff(ai.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 2.020202
plot_diff(ai.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  5.252525 - 10.000000

The model that accounts for the influence of duree.ms. on the trajectories.

ai.mas.f2.gam.dur <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(duree.ms., bs="cr") +
                              ti(measurement.no, duree.ms.) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ai.mas, method="ML")
summary.coefs(ai.mas.f2.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1826.36      25.30  72.182  < 2e-16 ***
## ton.ord2     -210.79      27.64  -7.627 5.22e-14 ***
## ton.ord3     -190.56      27.77  -6.861 1.15e-11 ***
## ton.ord4     -178.75      26.32  -6.793 1.81e-11 ***
## 
## Approximate significance of smooth terms:
##                                edf Ref.df      F  p-value    
## s(measurement.no)            3.893  4.783  8.213 6.26e-07 ***
## s(duree.ms.)                 3.903  4.707  5.118 0.000252 ***
## ti(measurement.no,duree.ms.) 2.869  4.012 12.552  < 2e-16 ***
## s(measurement.no):ton.ord2   1.001  1.002  1.332 0.248618    
## s(measurement.no):ton.ord3   1.001  1.003  0.351 0.553691    
## s(measurement.no):ton.ord4   1.001  1.003  0.038 0.847241

The plots with regard the durations.

plot_smooth(ai.mas.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.mas.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.mas.f2.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(ai.mas$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 80.084553 to 197.994270. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

ai.mas.f2.gam.f0 <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(f0, bs="cr") +
                              ti(measurement.no, f0) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ai.mas, method="ML")
summary.coefs(ai.mas.f2.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1809.15      24.68  73.316  < 2e-16 ***
## ton.ord2     -187.20      27.28  -6.862 1.21e-11 ***
## ton.ord3     -201.12      28.74  -6.999 4.80e-12 ***
## ton.ord4     -156.85      25.33  -6.191 8.79e-10 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F  p-value    
## s(measurement.no)          4.100  5.036 9.733  < 2e-16 ***
## s(f0)                      5.833  6.673 5.023 2.82e-05 ***
## ti(measurement.no,f0)      2.307  2.805 2.708   0.0422 *  
## s(measurement.no):ton.ord2 1.001  1.002 0.005   0.9472    
## s(measurement.no):ton.ord3 1.001  1.001 0.034   0.8553    
## s(measurement.no):ton.ord4 1.004  1.008 0.011   0.9373
plot_smooth(ai.mas.f2.gam.f0, view="measurement.no", cond=list(f0=100),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 100. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.mas.f2.gam.f0, view="measurement.no", cond=list(f0=120),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 120. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.mas.f2.gam.f0, view="measurement.no", cond=list(f0=140),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 140. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.mas.f2.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.mas.f2.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.mas.f2.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(ai.mas$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 100.125696 to 212.400605. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

The central portion:

ai.central.mas.f2.gam.diff <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                        s(measurement.no, by=ton.ord, bs="cr",k=6),
                      data=ai.central.mas, method="ML")
summary.coefs(ai.central.mas.f2.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1797.78      28.10  63.974  < 2e-16 ***
## ton.ord2     -169.65      30.20  -5.618 2.77e-08 ***
## ton.ord3     -154.65      31.23  -4.952 9.20e-07 ***
## ton.ord4     -136.24      29.09  -4.683 3.38e-06 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F p-value   
## s(measurement.no)          1.005  1.011 7.229 0.00732 **
## s(measurement.no):ton.ord2 1.001  1.002 0.268 0.60543   
## s(measurement.no):ton.ord3 1.001  1.002 0.035 0.85460   
## s(measurement.no):ton.ord4 1.001  1.003 0.595 0.44147
plot_smooth(ai.central.mas.f2.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(ai.central.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  2.000000 - 8.000000
plot_diff(ai.central.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## Difference is not significant.
plot_diff(ai.central.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  6.242424 - 8.000000
plot_diff(ai.central.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  3.939394 - 7.454545
ai.central.mas.f2.gam.dur <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(duree.ms., bs="cr",k=6) +
                              ti(measurement.no, duree.ms.,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=ai.central.mas, method="ML")
summary.coefs(ai.central.mas.f2.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1809.11      27.47  65.867  < 2e-16 ***
## ton.ord2     -178.42      29.78  -5.992 3.30e-09 ***
## ton.ord3     -158.81      30.29  -5.243 2.09e-07 ***
## ton.ord4     -152.09      28.53  -5.331 1.32e-07 ***
## 
## Approximate significance of smooth terms:
##                                edf Ref.df     F  p-value    
## s(measurement.no)            1.106  1.204 6.368  0.01168 *  
## s(duree.ms.)                 2.613  3.155 4.432  0.00315 ** 
## ti(measurement.no,duree.ms.) 3.274  4.240 7.847 2.48e-06 ***
## s(measurement.no):ton.ord2   1.001  1.002 1.433  0.23173    
## s(measurement.no):ton.ord3   1.001  1.002 0.023  0.88142    
## s(measurement.no):ton.ord4   1.002  1.003 0.342  0.56017
plot_smooth(ai.central.mas.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.mas.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.central.mas.f2.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(ai.central.mas$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 80.084553 to 197.994270. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

ai.central.mas.f2.gam.f0 <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(f0, bs="cr",k=6) +
                              ti(measurement.no, f0,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=ai.central.mas, method="ML")
summary.coefs(ai.central.mas.f2.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1808.72      25.82  70.057  < 2e-16 ***
## ton.ord2     -183.71      28.33  -6.485 1.74e-10 ***
## ton.ord3     -198.13      29.76  -6.658 5.86e-11 ***
## ton.ord4     -147.99      26.51  -5.582 3.48e-08 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F  p-value    
## s(measurement.no)          1.001  1.002 9.506  0.00212 ** 
## s(f0)                      4.105  4.579 7.115 2.97e-06 ***
## ti(measurement.no,f0)      5.049  5.936 5.348 2.37e-05 ***
## s(measurement.no):ton.ord2 1.001  1.001 0.421  0.51700    
## s(measurement.no):ton.ord3 1.001  1.001 0.465  0.49561    
## s(measurement.no):ton.ord4 1.001  1.001 0.610  0.43499
plot_smooth(ai.central.mas.f2.gam.f0, view="measurement.no", cond=list(f0=100),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 100. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.mas.f2.gam.f0, view="measurement.no", cond=list(f0=120),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 120. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.mas.f2.gam.f0, view="measurement.no", cond=list(f0=140),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 140. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.mas.f2.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.mas.f2.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.central.mas.f2.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(ai.mas$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 100.125696 to 212.400605. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

1.2 Féminin

1.2.1 F1

We now switch to the data of feminin subjects. First we drow the trajectories of f1 in different tones with regard of the sexes and the durations with ggplot2.

ggplot(ai.fem, aes(x=measurement.no, y=f1, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 25 row(s) containing missing values (geom_path).

Then the first model with a basic smooth of tone 1 and difference smooths.

ai.fem$ton.ord <- as.ordered(ai.fem$ton)
contrasts(ai.fem$ton.ord) <- "contr.treatment"
ai.fem.gam.diff <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                        s(measurement.no, by=ton.ord, bs="cr"),
                      data=ai.fem, method="ML")
summary.coefs(ai.fem.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  727.300     10.502  69.251  < 2e-16 ***
## ton.ord2      41.824     12.745   3.282  0.00106 ** 
## ton.ord3       9.285     13.129   0.707  0.47957    
## ton.ord4      -4.129     11.138  -0.371  0.71090    
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F p-value    
## s(measurement.no)          4.990  6.014 22.139 < 2e-16 ***
## s(measurement.no):ton.ord2 1.976  2.459  3.589 0.02225 *  
## s(measurement.no):ton.ord3 1.004  1.008  4.710 0.03005 *  
## s(measurement.no):ton.ord4 2.916  3.598  4.183 0.00373 **

Then the plots of predictions and difference smooth.

plot_smooth(ai.fem.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(ai.fem.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 4.343434
plot_diff(ai.fem.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 2.323232
##  7.777778 - 10.000000
plot_diff(ai.fem.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 2.828283
##  6.161616 - 7.676768

The model that accounts for the influence of duree.ms. on the trajectories.

ai.fem.gam.dur <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(duree.ms., bs="cr") +
                              ti(measurement.no, duree.ms.) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ai.fem, method="ML")
summary.coefs(ai.fem.gam.dur)
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 725.48603   10.51394  69.002  < 2e-16 ***
## ton.ord2     38.51010   12.39140   3.108  0.00193 ** 
## ton.ord3      9.42465   13.15220   0.717  0.47377    
## ton.ord4      0.02272   11.37780   0.002  0.99841    
## 
## Approximate significance of smooth terms:
##                                edf Ref.df      F p-value    
## s(measurement.no)            5.275  6.330 25.533 < 2e-16 ***
## s(duree.ms.)                 7.132  8.041  6.159 < 2e-16 ***
## ti(measurement.no,duree.ms.) 8.571 10.747  5.436 < 2e-16 ***
## s(measurement.no):ton.ord2   2.039  2.534  3.642 0.01899 *  
## s(measurement.no):ton.ord3   1.007  1.012 10.009 0.00158 ** 
## s(measurement.no):ton.ord4   2.434  3.015  2.159 0.09079 .

The plots with regard the durations.

plot_smooth(ai.fem.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.fem.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.fem.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(ai.fem$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 89.970028 to 186.666330. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

The model with regard of f0.

ai.fem.gam.f0 <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(f0, bs="cr") +
                              ti(measurement.no, f0) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ai.fem, method="ML")
summary.coefs(ai.fem.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  726.023     10.603  68.474   <2e-16 ***
## ton.ord2      36.953     14.222   2.598   0.0095 ** 
## ton.ord3      15.256     14.126   1.080   0.2804    
## ton.ord4      -2.092     11.020  -0.190   0.8494    
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F  p-value    
## s(measurement.no)          5.092  6.142 32.725  < 2e-16 ***
## s(f0)                      1.000  1.000  1.679 0.195397    
## ti(measurement.no,f0)      2.285  2.770  5.741 0.000985 ***
## s(measurement.no):ton.ord2 1.000  1.001  0.466 0.495028    
## s(measurement.no):ton.ord3 1.000  1.001  0.245 0.620400    
## s(measurement.no):ton.ord4 2.564  3.184  3.425 0.015002 *

The plot of such model.

plot_smooth(ai.fem.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.fem.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.fem.gam.f0, view="measurement.no", cond=list(f0=220),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 220. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.fem.gam.f0, view="measurement.no", cond=list(f0=240),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 240. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.fem.gam.f0, view="measurement.no", cond=list(f0=260),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 260. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.fem.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(ai.fem$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 159.611858 to 275.883293. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

#ai.mas.gam.smooth <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
#                           s(f0, bs="cr") +
#                           ti(measurement.no, f0) +
#                           s(measurement.no, by=ton.ord, bs="cr") +
#                           s(measurement.no, numero, bs="fs", xt="cr", m=1, k=5),
#                         data=ai.mas, method="fREML")

We now focus on the central portion of the diphthongs, which means the portions without the inluence of the consonant contexts.

ai.central.fem$ton.ord <- as.ordered(ai.central.fem$ton)
contrasts(ai.central.fem$ton.ord) <- "contr.treatment"
ai.central.fem.gam.diff <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                        s(measurement.no, by=ton.ord, bs="cr",k=6),
                      data=ai.central.fem, method="ML")
summary.coefs(ai.central.fem.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  764.464     10.337  73.951   <2e-16 ***
## ton.ord2      23.456     12.626   1.858   0.0636 .  
## ton.ord3       1.278     13.036   0.098   0.9219    
## ton.ord4       6.941     10.981   0.632   0.5275    
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F  p-value    
## s(measurement.no)          2.787  3.350 9.759 1.85e-06 ***
## s(measurement.no):ton.ord2 1.002  1.005 3.192   0.0744 .  
## s(measurement.no):ton.ord3 1.002  1.005 5.494   0.0192 *  
## s(measurement.no):ton.ord4 2.339  2.843 2.021   0.1193
plot_smooth(ai.central.fem.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(ai.central.fem.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  2.000000 - 4.848485
plot_diff(ai.central.fem.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  4.787879 - 7.090909
plot_diff(ai.central.fem.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  2.000000 - 2.969697
##  5.151515 - 8.000000
ai.central.fem.gam.dur <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(duree.ms., bs="cr",k=6) +
                              ti(measurement.no, duree.ms.,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=ai.central.fem, method="ML")
summary.coefs(ai.central.fem.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  765.093     10.573  72.362   <2e-16 ***
## ton.ord2      24.013     12.492   1.922    0.055 .  
## ton.ord3      -2.690     13.290  -0.202    0.840    
## ton.ord4       6.656     11.439   0.582    0.561    
## 
## Approximate significance of smooth terms:
##                                edf Ref.df      F  p-value    
## s(measurement.no)            2.800  3.363 10.238 9.86e-07 ***
## s(duree.ms.)                 4.244  4.713  3.477   0.0354 *  
## ti(measurement.no,duree.ms.) 2.227  2.802  2.612   0.0375 *  
## s(measurement.no):ton.ord2   1.001  1.002  3.054   0.0809 .  
## s(measurement.no):ton.ord3   1.001  1.002  5.522   0.0190 *  
## s(measurement.no):ton.ord4   2.354  2.860  2.097   0.1080
plot_smooth(ai.central.fem.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.fem.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.central.fem.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(ai.central.fem$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 89.970028 to 186.666330. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

ai.central.fem.gam.f0 <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(f0, bs="cr",k=6) +
                              ti(measurement.no, f0,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=ai.central.fem, method="ML")
summary.coefs(ai.central.fem.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   753.01      10.66  70.639   <2e-16 ***
## ton.ord2       40.34      14.26   2.829   0.0048 ** 
## ton.ord3       25.36      14.31   1.771   0.0769 .  
## ton.ord4       14.76      11.07   1.333   0.1828    
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F p-value    
## s(measurement.no)          2.956  3.535 12.622 < 2e-16 ***
## s(f0)                      1.000  1.001  9.090 0.00265 ** 
## ti(measurement.no,f0)      1.003  1.006  7.019 0.00817 ** 
## s(measurement.no):ton.ord2 1.001  1.002  1.025 0.31201    
## s(measurement.no):ton.ord3 1.001  1.001  1.560 0.21208    
## s(measurement.no):ton.ord4 2.117  2.590  1.603 0.18325
plot_smooth(ai.central.fem.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.fem.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.fem.gam.f0, view="measurement.no", cond=list(f0=220),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 220. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.fem.gam.f0, view="measurement.no", cond=list(f0=240),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 240. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.fem.gam.f0, view="measurement.no", cond=list(f0=260),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 260. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.central.fem.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(ai.fem$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 159.611858 to 275.883293. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

1.2.2 F2

Now we look at the trajectories of f2 in different tones with regard of the sexes and the durations.

ggplot(ai.fem, aes(x=measurement.no, y=f2, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 25 row(s) containing missing values (geom_path).

ggplot(ai.fem, aes(x=measurement.no, y=f2, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 25 row(s) containing missing values (geom_path).

Then we fit the same model with a basic smooth of tone 1 and difference smooths.

ai.fem.f2.gam.diff <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr") +
                        s(measurement.no, by=ton.ord, bs="cr"),
                      data=ai.fem, method="ML")
summary.coefs(ai.fem.f2.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2038.36      17.15 118.880  < 2e-16 ***
## ton.ord2     -107.98      20.81  -5.189 2.49e-07 ***
## ton.ord3      -88.98      21.43  -4.152 3.53e-05 ***
## ton.ord4      -70.79      18.18  -3.893 0.000105 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F  p-value    
## s(measurement.no)          4.280  5.234  3.945 0.001255 ** 
## s(measurement.no):ton.ord2 1.002  1.005 22.811 2.65e-06 ***
## s(measurement.no):ton.ord3 2.149  2.673  9.920 9.98e-06 ***
## s(measurement.no):ton.ord4 1.003  1.005 11.113 0.000866 ***

Now the plots of f2 with different tones.

plot_smooth(ai.fem.f2.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(ai.fem.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 6.666667
plot_diff(ai.fem.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  4.545455 - 5.959596
plot_diff(ai.fem.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 2.424242

The model that accounts for the influence of duree.ms. on the trajectories.

ai.fem.f2.gam.dur <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(duree.ms., bs="cr") +
                              ti(measurement.no, duree.ms.) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ai.fem, method="ML")
summary.coefs(ai.fem.f2.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2038.81      17.36 117.410  < 2e-16 ***
## ton.ord2     -102.76      20.46  -5.023 5.88e-07 ***
## ton.ord3      -87.08      21.69  -4.014 6.35e-05 ***
## ton.ord4      -73.67      18.78  -3.922 9.29e-05 ***
## 
## Approximate significance of smooth terms:
##                                edf Ref.df      F  p-value    
## s(measurement.no)            4.356  5.321  4.858 0.000157 ***
## s(duree.ms.)                 6.537  7.514  5.600 1.96e-06 ***
## ti(measurement.no,duree.ms.) 3.189  3.659  7.475 1.13e-05 ***
## s(measurement.no):ton.ord2   1.002  1.005 21.541 3.84e-06 ***
## s(measurement.no):ton.ord3   2.182  2.713  8.207 6.17e-05 ***
## s(measurement.no):ton.ord4   1.004  1.007  4.444 0.034836 *

The plots with regard the durations.

plot_smooth(ai.fem.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.fem.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.fem.f2.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(ai.fem$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 89.970028 to 186.666330. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

ai.fem.f2.gam.f0 <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(f0, bs="cr") +
                              ti(measurement.no, f0) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ai.fem, method="ML")
summary.coefs(ai.fem.f2.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2006.20      17.59 114.025   <2e-16 ***
## ton.ord2      -47.56      23.69  -2.008   0.0449 *  
## ton.ord3      -39.15      23.59  -1.660   0.0972 .  
## ton.ord4      -33.95      18.66  -1.819   0.0691 .  
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F  p-value    
## s(measurement.no)          3.765  4.647  3.339 0.006051 ** 
## s(f0)                      4.465  5.325  9.702  < 2e-16 ***
## ti(measurement.no,f0)      1.001  1.002  3.953 0.046912 *  
## s(measurement.no):ton.ord2 1.000  1.001  7.075 0.007921 ** 
## s(measurement.no):ton.ord3 1.878  2.345  4.999 0.004516 ** 
## s(measurement.no):ton.ord4 1.001  1.002 14.369 0.000158 ***
plot_smooth(ai.fem.f2.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.fem.f2.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.fem.f2.gam.f0, view="measurement.no", cond=list(f0=220),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 220. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.fem.f2.gam.f0, view="measurement.no", cond=list(f0=240),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 240. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.fem.f2.gam.f0, view="measurement.no", cond=list(f0=260),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 260. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.fem.f2.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(ai.fem$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 159.611858 to 275.883293. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

The central portion:

ai.central.fem.f2.gam.diff <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                        s(measurement.no, by=ton.ord, bs="cr",k=6),
                      data=ai.central.fem, method="ML")
summary.coefs(ai.central.fem.f2.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2048.03      17.96 114.046  < 2e-16 ***
## ton.ord2     -110.36      21.93  -5.032 6.06e-07 ***
## ton.ord3      -68.99      22.65  -3.047  0.00239 ** 
## ton.ord4      -74.75      19.08  -3.919 9.70e-05 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F p-value   
## s(measurement.no)          1.354  1.610 3.247 0.03218 * 
## s(measurement.no):ton.ord2 1.002  1.003 7.512 0.00623 **
## s(measurement.no):ton.ord3 1.002  1.004 6.353 0.01188 * 
## s(measurement.no):ton.ord4 1.108  1.194 1.388 0.20091
plot_smooth(ai.central.fem.f2.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(ai.central.fem.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  2.000000 - 6.727273
plot_diff(ai.central.fem.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  3.757576 - 5.818182
plot_diff(ai.central.fem.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## Difference is not significant.
plot_diff(ai.central.fem.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  2.000000 - 5.333333
ai.central.fem.f2.gam.dur <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(duree.ms., bs="cr",k=6) +
                              ti(measurement.no, duree.ms.,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=ai.central.fem, method="ML")
summary.coefs(ai.central.fem.f2.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2057.82      18.18 113.168  < 2e-16 ***
## ton.ord2     -114.28      21.48  -5.321 1.36e-07 ***
## ton.ord3      -74.34      22.87  -3.251   0.0012 ** 
## ton.ord4      -88.36      19.67  -4.491 8.18e-06 ***
## 
## Approximate significance of smooth terms:
##                                edf Ref.df     F  p-value    
## s(measurement.no)            1.226  1.395 6.156 0.005088 ** 
## s(duree.ms.)                 4.351  4.781 5.615 0.000994 ***
## ti(measurement.no,duree.ms.) 2.317  2.905 5.698 0.001249 ** 
## s(measurement.no):ton.ord2   1.001  1.002 7.310 0.006986 ** 
## s(measurement.no):ton.ord3   1.001  1.002 4.581 0.032602 *  
## s(measurement.no):ton.ord4   1.276  1.479 0.171 0.687964
plot_smooth(ai.central.fem.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.fem.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.central.fem.f2.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(ai.central.fem$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 89.970028 to 186.666330. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

ai.central.fem.f2.gam.f0 <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(f0, bs="cr",k=6) +
                              ti(measurement.no, f0,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=ai.central.fem, method="ML")
summary.coefs(ai.central.fem.f2.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2010.59      18.67 107.680   <2e-16 ***
## ton.ord2      -46.55      25.44  -1.830   0.0677 .  
## ton.ord3      -24.49      25.01  -0.979   0.3278    
## ton.ord4      -31.78      19.74  -1.610   0.1079    
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F p-value    
## s(measurement.no)          1.019  1.036  9.108 0.00263 ** 
## s(f0)                      3.656  4.215 12.066 < 2e-16 ***
## ti(measurement.no,f0)      2.960  3.539  4.413 0.00284 ** 
## s(measurement.no):ton.ord2 1.001  1.001  2.724 0.09917 .  
## s(measurement.no):ton.ord3 1.001  1.001  2.309 0.12896    
## s(measurement.no):ton.ord4 1.158  1.296  1.005 0.41341
plot_smooth(ai.central.fem.f2.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.fem.f2.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.fem.f2.gam.f0, view="measurement.no", cond=list(f0=220),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 220. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.fem.f2.gam.f0, view="measurement.no", cond=list(f0=240),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 240. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ai.central.fem.f2.gam.f0, view="measurement.no", cond=list(f0=260),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 260. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ai.central.fem.f2.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(ai.fem$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 159.611858 to 275.883293. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

2 /au/

The next diphthong we look at is /au/.

au$sexe<-as.factor(au$sexe)
au$ton<-as.factor(au$ton)
au$pow<-as.factor(au$pow)
au$contexte.D<-as.factor(au$contexte.D)
au$contexte.G<-as.factor(au$contexte.G)

au$f1<-as.numeric(au$f1)
## Warning: NAs introduced by coercion
au$f2<-as.numeric(au$f2)
## Warning: NAs introduced by coercion
au$f3<-as.numeric(au$f3)
## Warning: NAs introduced by coercion
au$f0<-as.numeric(au$f0)
## Warning: NAs introduced by coercion
# Regroupement par les facteurs
au.mas <- droplevels(subset(au,sexe=="M"))
au.fem <- droplevels(subset(au,sexe=="F"))

2.1 Masculin

2.1.1 F1

Then the trajectories of f1 in different tones with regard of the sexes and the durations.

ggplot(au.mas, aes(x=measurement.no, y=f1, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 28 row(s) containing missing values (geom_path).

ggplot(au.fem, aes(x=measurement.no, y=f1, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 5 row(s) containing missing values (geom_path).

Then the first model with a basic smooth of tone 1 and difference smooths.

au.mas$ton.ord <- as.ordered(au.mas$ton)
contrasts(ai.mas$ton.ord) <- "contr.treatment"
au.mas.gam.diff <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                        s(measurement.no, by=ton.ord, bs="cr"),
                      data=au.mas, method="ML")
summary.coefs(au.mas.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  653.579      6.079 107.522  < 2e-16 ***
## ton.ord.L     92.904     10.611   8.755  < 2e-16 ***
## ton.ord.Q    -79.485     12.157  -6.538  9.4e-11 ***
## ton.ord.C     43.908     13.528   3.246  0.00121 ** 
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F p-value    
## s(measurement.no)          5.228  6.297 17.678 < 2e-16 ***
## s(measurement.no):ton.ord2 1.133  1.254  2.295 0.09241 .  
## s(measurement.no):ton.ord3 1.002  1.005  0.364 0.54665    
## s(measurement.no):ton.ord4 1.016  1.032  8.584 0.00342 **

Then the plots of predictions and difference smooth.

plot_smooth(au.mas.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(au.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 10.000000
plot_diff(au.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## Difference is not significant.
plot_diff(au.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.000000 - 2.525253
##  6.868687 - 10.000000

The model that accounts for the influence of duree.ms. on the trajectories.

au.mas.gam.dur <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(duree.ms., bs="cr") +
                              ti(measurement.no, duree.ms.) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=au.mas, method="ML")
summary.coefs(au.mas.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  650.142      6.024 107.929  < 2e-16 ***
## ton.ord.L     98.438     10.450   9.420  < 2e-16 ***
## ton.ord.Q    -72.959     12.090  -6.035 2.16e-09 ***
## ton.ord.C     42.837     13.539   3.164   0.0016 ** 
## 
## Approximate significance of smooth terms:
##                                edf Ref.df     F  p-value    
## s(measurement.no)            5.099  6.148 9.388  < 2e-16 ***
## s(duree.ms.)                 6.844  7.743 5.934 4.75e-07 ***
## ti(measurement.no,duree.ms.) 5.769  7.821 2.188  0.03051 *  
## s(measurement.no):ton.ord2   1.228  1.417 1.818  0.11762    
## s(measurement.no):ton.ord3   1.003  1.005 0.390  0.53369    
## s(measurement.no):ton.ord4   2.064  2.565 4.619  0.00881 **

The plots with regard the durations.

plot_smooth(au.mas.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.mas.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(au.mas.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(au.mas$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 88.249203 to 188.623093. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

The model with regard of f0.

au.mas.gam.f0 <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(f0, bs="cr") +
                              ti(measurement.no, f0) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=au.mas, method="ML")
summary.coefs(au.mas.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  646.170      5.867 110.142  < 2e-16 ***
## ton.ord.L     66.939     11.132   6.013 2.63e-09 ***
## ton.ord.Q    -73.220     12.391  -5.909 4.86e-09 ***
## ton.ord.C     56.950     13.067   4.358 1.46e-05 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F  p-value    
## s(measurement.no)          5.303  6.384 17.712  < 2e-16 ***
## s(f0)                      6.430  7.259 11.991  < 2e-16 ***
## ti(measurement.no,f0)      1.001  1.001 19.887 9.23e-06 ***
## s(measurement.no):ton.ord2 1.987  2.477  1.399    0.222    
## s(measurement.no):ton.ord3 1.001  1.002  1.609    0.205    
## s(measurement.no):ton.ord4 1.001  1.002  0.023    0.882

The plot of such model.

plot_smooth(au.mas.gam.f0, view="measurement.no", cond=list(f0=100),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 100. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.mas.gam.f0, view="measurement.no", cond=list(f0=120),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 120. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.mas.gam.f0, view="measurement.no", cond=list(f0=140),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 140. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.mas.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.mas.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(au.mas.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(au.mas$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 96.765573 to 193.084157. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

We now focus on the central portion of the diphthongs, which means the portions without the inluence of the consonant contexts.

au.central<-droplevels(subset(au,measurement.no>=2))
au.central<-droplevels(subset(au.central,measurement.no<=8))

au.central.mas <- droplevels(subset(au.central,sexe=="M"))
au.central.fem <- droplevels(subset(au.central,sexe=="F"))
au.central.mas$ton.ord <- as.ordered(au.central.mas$ton)
contrasts(au.central.mas$ton.ord) <- "contr.treatment"
au.central.mas.gam.diff <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                        s(measurement.no, by=ton.ord, bs="cr",k=6),
                      data=au.central.mas, method="ML")
summary.coefs(au.central.mas.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   558.70      13.33  41.901  < 2e-16 ***
## ton.ord2      153.73      22.20   6.926 9.46e-12 ***
## ton.ord3      148.03      15.44   9.588  < 2e-16 ***
## ton.ord4      153.02      14.19  10.781  < 2e-16 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F  p-value    
## s(measurement.no)          2.692  3.266 9.376 2.94e-06 ***
## s(measurement.no):ton.ord2 1.003  1.007 2.218   0.1358    
## s(measurement.no):ton.ord3 1.001  1.002 2.129   0.1449    
## s(measurement.no):ton.ord4 1.000  1.001 5.466   0.0197 *
plot_smooth(au.central.mas.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(au.central.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  2.000000 - 8.000000
plot_diff(au.central.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## Difference is not significant.
plot_diff(au.central.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## Difference is not significant.
au.central.mas.gam.dur <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(duree.ms., bs="cr",k=6) +
                              ti(measurement.no, duree.ms.,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=au.central.mas, method="ML")
summary.coefs(au.central.mas.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   553.39      12.75  43.405  < 2e-16 ***
## ton.ord2      149.36      21.42   6.971 7.04e-12 ***
## ton.ord3      144.26      14.73   9.790  < 2e-16 ***
## ton.ord4      163.53      13.64  11.987  < 2e-16 ***
## 
## Approximate significance of smooth terms:
##                                edf Ref.df      F p-value    
## s(measurement.no)            2.768  3.350  9.836 1.6e-06 ***
## s(duree.ms.)                 4.797  4.975 12.714 < 2e-16 ***
## ti(measurement.no,duree.ms.) 1.342  1.603  7.822 0.00402 ** 
## s(measurement.no):ton.ord2   1.002  1.003  3.412 0.06477 .  
## s(measurement.no):ton.ord3   1.001  1.001  2.348 0.12578    
## s(measurement.no):ton.ord4   1.002  1.004  4.081 0.04380 *
plot_smooth(au.central.mas.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.central.mas.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(au.central.mas.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(au.central.mas$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 88.249203 to 188.623093. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

au.central.mas.gam.f0 <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(f0, bs="cr",k=6) +
                              ti(measurement.no, f0,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=au.central.mas, method="ML")
summary.coefs(au.central.mas.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   567.54      13.32  42.604  < 2e-16 ***
## ton.ord2      144.91      21.04   6.886 1.44e-11 ***
## ton.ord3      110.99      16.53   6.716 4.32e-11 ***
## ton.ord4      126.86      14.31   8.869  < 2e-16 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F  p-value    
## s(measurement.no)          2.753  3.334  6.987 8.87e-05 ***
## s(f0)                      4.636  4.908 12.260  < 2e-16 ***
## ti(measurement.no,f0)      1.526  1.880  6.984  0.00104 ** 
## s(measurement.no):ton.ord2 1.104  1.199  0.634  0.52311    
## s(measurement.no):ton.ord3 1.001  1.001  0.104  0.74696    
## s(measurement.no):ton.ord4 1.000  1.001  0.516  0.47274
plot_smooth(au.central.mas.gam.f0, view="measurement.no", cond=list(f0=100),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 100. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.central.mas.gam.f0, view="measurement.no", cond=list(f0=120),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 120. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.central.mas.gam.f0, view="measurement.no", cond=list(f0=140),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 140. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.central.mas.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.central.mas.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(au.central.mas.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(au.mas$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 96.765573 to 193.084157. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

2.1.2 F2

Now we look at the trajectories of f2 in different tones with regard of the sexes and the durations.

ggplot(au.mas, aes(x=measurement.no, y=f2, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 28 row(s) containing missing values (geom_path).

ggplot(au.fem, aes(x=measurement.no, y=f2, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 5 row(s) containing missing values (geom_path).

au.mas.f2.gam.diff <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr") +
                        s(measurement.no, by=ton.ord, bs="cr"),
                      data=au.mas, method="ML")
summary.coefs(au.mas.f2.gam.diff)
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 1146.0817    16.3782  69.976  < 2e-16 ***
## ton.ord.L     90.9336    28.5895   3.181  0.00151 ** 
## ton.ord.Q     43.3800    32.7569   1.324  0.18567    
## ton.ord.C     -0.6071    36.4515  -0.017  0.98672    
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F p-value    
## s(measurement.no)          4.666  5.675 18.874  <2e-16 ***
## s(measurement.no):ton.ord2 1.784  2.221  0.541   0.526    
## s(measurement.no):ton.ord3 1.005  1.011  1.026   0.309    
## s(measurement.no):ton.ord4 1.003  1.006  0.830   0.362

Now the plots of f2 with different tones.

plot_smooth(au.mas.f2.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(au.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## Difference is not significant.
plot_diff(au.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## Difference is not significant.
plot_diff(au.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  3.737374 - 10.000000

The model that accounts for the influence of duree.ms. on the trajectories.

au.mas.f2.gam.dur <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(duree.ms., bs="cr") +
                              ti(measurement.no, duree.ms.) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=au.mas, method="ML")
summary.coefs(au.mas.f2.gam.dur)
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 1144.7951    16.5584  69.137  < 2e-16 ***
## ton.ord.L     92.7316    28.8176   3.218  0.00133 ** 
## ton.ord.Q     44.8780    32.9935   1.360  0.17403    
## ton.ord.C     -0.9374    36.4501  -0.026  0.97949    
## 
## Approximate significance of smooth terms:
##                                edf Ref.df      F p-value    
## s(measurement.no)            4.674  5.685 19.246  <2e-16 ***
## s(duree.ms.)                 1.002  1.003  0.149   0.700    
## ti(measurement.no,duree.ms.) 4.177  5.924  0.988   0.403    
## s(measurement.no):ton.ord2   1.491  1.827  0.365   0.696    
## s(measurement.no):ton.ord3   1.017  1.033  0.971   0.315    
## s(measurement.no):ton.ord4   1.002  1.004  0.825   0.363

The plots with regard the durations.

plot_smooth(au.mas.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.mas.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(au.mas.f2.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(au.mas$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 88.249203 to 188.623093. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

au.mas.f2.gam.f0 <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(f0, bs="cr") +
                              ti(measurement.no, f0) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=au.mas, method="ML")
summary.coefs(au.mas.f2.gam.f0)
## Parametric coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 1145.1726    16.3532  70.028  < 2e-16 ***
## ton.ord.L     79.9037    30.4263   2.626  0.00878 ** 
## ton.ord.Q     30.5677    34.3775   0.889  0.37414    
## ton.ord.C      0.3648    36.1553   0.010  0.99195    
## 
## Approximate significance of smooth terms:
##                              edf Ref.df      F p-value    
## s(measurement.no)          4.420  5.403 16.115 < 2e-16 ***
## s(f0)                      1.000  1.000  0.022 0.88388    
## ti(measurement.no,f0)      1.001  1.002  8.948 0.00285 ** 
## s(measurement.no):ton.ord2 2.161  2.690  1.530 0.28340    
## s(measurement.no):ton.ord3 1.001  1.002  2.489 0.11474    
## s(measurement.no):ton.ord4 1.001  1.002  0.204 0.65200
plot_smooth(au.mas.f2.gam.f0, view="measurement.no", cond=list(f0=100),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 100. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.mas.f2.gam.f0, view="measurement.no", cond=list(f0=120),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 120. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.mas.f2.gam.f0, view="measurement.no", cond=list(f0=140),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 140. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.mas.f2.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.mas.f2.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(au.mas.f2.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(au.mas$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 96.765573 to 193.084157. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

The central portion:

au.central.mas.f2.gam.diff <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                        s(measurement.no, by=ton.ord, bs="cr",k=6),
                      data=au.central.mas, method="ML")
summary.coefs(au.central.mas.f2.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1021.70      38.86  26.290   <2e-16 ***
## ton.ord2      -41.61      64.69  -0.643   0.5203    
## ton.ord3       70.25      45.00   1.561   0.1189    
## ton.ord4      137.90      41.37   3.334   0.0009 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F p-value  
## s(measurement.no)          1.745  2.121 1.417  0.2323  
## s(measurement.no):ton.ord2 1.001  1.002 0.020  0.8896  
## s(measurement.no):ton.ord3 1.002  1.005 0.757  0.3836  
## s(measurement.no):ton.ord4 1.893  2.307 2.377  0.0804 .
plot_smooth(au.central.mas.f2.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(au.central.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## Difference is not significant.
plot_diff(au.central.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  4.969697 - 7.272727
plot_diff(au.central.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  6.000000 - 8.000000
plot_diff(au.central.mas.f2.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 2.000000 to 8.000000.

## 
## measurement.no window(s) of significant difference(s):
##  4.060606 - 8.000000
au.central.mas.f2.gam.dur <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(duree.ms., bs="cr",k=6) +
                              ti(measurement.no, duree.ms.,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=au.central.mas, method="ML")
summary.coefs(au.central.mas.f2.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1023.68      38.89  26.324  < 2e-16 ***
## ton.ord2      -40.19      64.86  -0.620  0.53563    
## ton.ord3       69.89      44.92   1.556  0.12012    
## ton.ord4      134.96      41.55   3.248  0.00121 **
plot_smooth(au.central.mas.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.central.mas.f2.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(au.central.mas.f2.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(au.central.mas$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 88.249203 to 188.623093. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

au.central.mas.f2.gam.f0 <- bam(f2 ~ ton.ord + s(measurement.no, bs="cr",k=6) +
                              s(f0, bs="cr",k=6) +
                              ti(measurement.no, f0,k=6) +
                              s(measurement.no, by=ton.ord, bs="cr",k=6),
                         data=au.central.mas, method="ML")
summary.coefs(au.central.mas.f2.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1011.64      37.07  27.290  < 2e-16 ***
## ton.ord2      -29.61      58.83  -0.503 0.614896    
## ton.ord3       88.26      45.33   1.947 0.052013 .  
## ton.ord4      138.85      39.62   3.505 0.000491 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F p-value  
## s(measurement.no)          1.119  1.210 0.434  0.4770  
## s(f0)                      1.000  1.000 0.357  0.5506  
## ti(measurement.no,f0)      1.002  1.004 1.509  0.2199  
## s(measurement.no):ton.ord2 1.000  1.000 0.206  0.6501  
## s(measurement.no):ton.ord3 1.001  1.001 0.490  0.4838  
## s(measurement.no):ton.ord4 2.243  2.742 3.078  0.0267 *
plot_smooth(au.central.mas.f2.gam.f0, view="measurement.no", cond=list(f0=100),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 100. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.central.mas.f2.gam.f0, view="measurement.no", cond=list(f0=120),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 120. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.central.mas.f2.gam.f0, view="measurement.no", cond=list(f0=140),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 140. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.central.mas.f2.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(au.central.mas.f2.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(au.central.mas.f2.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(au.mas$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 2.000000 to 8.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 96.765573 to 193.084157. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

3 /ei/

The third one is diphthong /ei/.

ei$sexe<-as.factor(ei$sexe)
ei$ton<-as.factor(ei$ton)
ei$pow<-as.factor(ei$pow)
ei$contexte.D<-as.factor(ei$contexte.D)
ei$contexte.G<-as.factor(ei$contexte.G)

ei$f1<-as.numeric(ei$f1)
## Warning: NAs introduced by coercion
ei$f2<-as.numeric(ei$f2)
## Warning: NAs introduced by coercion
ei$f3<-as.numeric(ei$f3)
## Warning: NAs introduced by coercion
ei$f0<-as.numeric(ei$f0)
## Warning: NAs introduced by coercion
# Regroupement par les facteurs
ei.mas <- droplevels(subset(ei,sexe=="M"))
ei.fem <- droplevels(subset(ei,sexe=="F"))

3.1 Masculin

3.1.1 F1

Then the trajectories of f1 in different tones with regard of the sexes and the durations.

ggplot(ei.mas, aes(x=measurement.no, y=f1, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 17 row(s) containing missing values (geom_path).

ggplot(ei.fem, aes(x=measurement.no, y=f1, group=numero,
                     alpha=duree.ms.)) +
  facet_grid(~ton) + geom_line()
## Warning: Removed 5 row(s) containing missing values (geom_path).

The basic model with the tone.

ei.mas$ton.ord <- as.ordered(ei.mas$ton)
contrasts(ei.mas$ton.ord) <- "contr.treatment"
ei.mas.gam.diff <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                        s(measurement.no, by=ton.ord, bs="cr"),
                      data=ei.mas, method="ML")
summary.coefs(ei.mas.gam.diff)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   382.24      21.92  17.440  < 2e-16 ***
## ton.ord2       15.28      26.52   0.576 0.564521    
## ton.ord3       80.97      23.54   3.439 0.000604 ***
## ton.ord4       96.06      24.49   3.922 9.27e-05 ***

Then the plots of predictions and difference smooth.

plot_smooth(ei.mas.gam.diff, view="measurement.no",
            plot_all="ton.ord", rug=F)
## Summary:
##  * ton.ord : factor; set to the value(s): 1, 2, 3, 4. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * NOTE : No random effects in the model to cancel.
## 

plot_diff(ei.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("1","2")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## Difference is not significant.
plot_diff(ei.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("2","3")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## measurement.no window(s) of significant difference(s):
##  0.505051 - 8.181818
plot_diff(ei.mas.gam.diff, view="measurement.no",
          comp=list(ton.ord=c("3","4")))
## Summary:
##  * measurement.no : numeric predictor; with 100 values ranging from 0.000000 to 10.000000.

## 
## Difference is not significant.

The model that accounts for the influence of duree.ms. on the trajectories.

ei.mas.gam.dur <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(duree.ms., bs="cr") +
                              ti(measurement.no, duree.ms.) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ei.mas, method="ML")
summary.coefs(ei.mas.gam.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  383.014     22.572  16.969  < 2e-16 ***
## ton.ord2       2.031     27.687   0.073 0.941525    
## ton.ord3      90.245     24.282   3.717 0.000211 ***
## ton.ord4      85.518     25.448   3.361 0.000803 ***
## 
## Approximate significance of smooth terms:
##                                edf Ref.df     F p-value    
## s(measurement.no)            1.006  1.011 0.711  0.3988    
## s(duree.ms.)                 7.575  8.320 8.362  <2e-16 ***
## ti(measurement.no,duree.ms.) 5.104  6.914 2.222  0.0305 *  
## s(measurement.no):ton.ord2   2.143  2.663 0.964  0.3046    
## s(measurement.no):ton.ord3   1.471  1.798 0.207  0.7371    
## s(measurement.no):ton.ord4   1.005  1.010 1.189  0.2746

The plots with regard the durations.

plot_smooth(ei.mas.gam.dur, view="measurement.no", cond=list(duree.ms.=170),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 170. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ei.mas.gam.dur, view="measurement.no", cond=list(duree.ms.=80),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; set to the value(s): 80. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ei.mas.gam.dur, view=c("measurement.no","duree.ms."),
        ylim=quantile(ei.mas$duree.ms., c(0.1, 0.9)))
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * duree.ms. : numeric predictor; with 30 values ranging from 69.653645 to 160.541647. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

The model with regard of f0.

ei.mas.gam.f0 <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(f0, bs="cr") +
                              ti(measurement.no, f0) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ei.mas, method="ML")
summary.coefs(ei.mas.gam.f0)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   399.41      22.83  17.494  < 2e-16 ***
## ton.ord2       17.73      27.32   0.649 0.516427    
## ton.ord3       51.91      25.31   2.051 0.040519 *  
## ton.ord4       97.15      25.32   3.837 0.000131 ***
## 
## Approximate significance of smooth terms:
##                              edf Ref.df     F p-value    
## s(measurement.no)          1.002  1.003 1.014  0.3142    
## s(f0)                      5.427  6.335 7.715  <2e-16 ***
## ti(measurement.no,f0)      2.687  3.138 2.545  0.0699 .  
## s(measurement.no):ton.ord2 2.055  2.568 1.245  0.2285    
## s(measurement.no):ton.ord3 1.003  1.006 0.006  0.9567    
## s(measurement.no):ton.ord4 1.002  1.003 2.035  0.1536

The plot of such model.

plot_smooth(ei.mas.gam.f0, view="measurement.no", cond=list(f0=100),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 100. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ei.mas.gam.f0, view="measurement.no", cond=list(f0=120),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 120. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ei.mas.gam.f0, view="measurement.no", cond=list(f0=140),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 140. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ei.mas.gam.f0, view="measurement.no", cond=list(f0=180),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ei.mas.gam.f0, view="measurement.no", cond=list(f0=200),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ei.mas.gam.f0, view=c("measurement.no","f0"),
        ylim=quantile(ei.mas$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 92.830073 to 209.388440. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

ei.mas.gam.f0.dur <- bam(f1 ~ ton.ord + s(measurement.no, bs="cr") +
                              s(f0, bs="cr") +
                              ti(measurement.no, f0) +
                              s(duree.ms., bs="cr") +
                              ti(measurement.no, duree.ms.) +
                              s(measurement.no, by=ton.ord, bs="cr"),
                         data=ei.mas, method="ML")
summary.coefs(ei.mas.gam.f0.dur)
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   391.24      23.22  16.853  < 2e-16 ***
## ton.ord2       15.12      28.39   0.532 0.594501    
## ton.ord3       70.49      25.83   2.729 0.006447 ** 
## ton.ord4       96.54      26.13   3.695 0.000231 ***
## 
## Approximate significance of smooth terms:
##                                edf Ref.df     F p-value    
## s(measurement.no)            1.002  1.004 2.001  0.1573    
## s(f0)                        5.595  6.509 7.350  <2e-16 ***
## ti(measurement.no,f0)        2.900  3.338 3.492  0.0267 *  
## s(duree.ms.)                 7.761  8.457 9.119  <2e-16 ***
## ti(measurement.no,duree.ms.) 5.515  7.444 1.983  0.0539 .  
## s(measurement.no):ton.ord2   2.300  2.862 2.052  0.0837 .  
## s(measurement.no):ton.ord3   1.003  1.006 0.099  0.7580    
## s(measurement.no):ton.ord4   1.002  1.003 1.069  0.3013
plot_smooth(ei.mas.gam.f0.dur, view="measurement.no", cond=list(f0=100),
            rug=F, col="red")
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 100. 
##  * duree.ms. : numeric predictor; set to the value(s): 106.033100625903. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ei.mas.gam.f0.dur, view="measurement.no", cond=list(f0=120),
            rug=F, col="orange", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 120. 
##  * duree.ms. : numeric predictor; set to the value(s): 106.033100625903. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ei.mas.gam.f0.dur, view="measurement.no", cond=list(f0=140),
            rug=F, col="yellow", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 140. 
##  * duree.ms. : numeric predictor; set to the value(s): 106.033100625903. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ei.mas.gam.f0.dur, view="measurement.no", cond=list(f0=180),
            rug=F, col="green", add=T)
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 180. 
##  * duree.ms. : numeric predictor; set to the value(s): 106.033100625903. 
##  * NOTE : No random effects in the model to cancel.
## 
plot_smooth(ei.mas.gam.f0.dur, view="measurement.no", cond=list(f0=200),
            rug=F, col="blue", add=T)

## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; set to the value(s): 200. 
##  * duree.ms. : numeric predictor; set to the value(s): 106.033100625903. 
##  * NOTE : No random effects in the model to cancel.
## 
fvisgam(ei.mas.gam.f0.dur, view=c("measurement.no","f0"),
        ylim=quantile(ei.mas$f0, c(0.1, 0.9), na.rm=TRUE))
## Summary:
##  * ton.ord : factor; set to the value(s): 3. 
##  * measurement.no : numeric predictor; with 30 values ranging from 0.000000 to 10.000000. 
##  * f0 : numeric predictor; with 30 values ranging from 92.830073 to 209.388440. 
##  * duree.ms. : numeric predictor; set to the value(s): 106.033100625903. 
##  * NOTE : No random effects in the model to cancel.
## 
## Warning in gradientLegend(c(min.z, max.z), n.seg = 3, pos = 0.875, color =
## pal, : Increase right margin to fit labels or decrease the number of decimals,
## see help(gradientLegend).

4 Analysis

4.1 Factor duration

The influence of the factor duration is commun in all the diphthongs. All the diphthongs will be realized as more monophthongized with a brief duration.

4.2 Factor f0

The General influence of the factor of f0 on the f1 and f2 is as such:

f0 and f1 is a negative correlation.

f0 and f2 is a positive correlation.

However, this correlation is influenced by other factors and not on the same level within the different diphthongs.

In diphthong /ai/, the correlation between f0 and f1 is positive within the female data, which should be regarded after.